import "../scss/case.scss";
// import "../swiper/swiper.min.css";
import "../swiper/animate.min.css";
import "../css/iconfont/iconfont.css";


import {WOW} from "../swiper/wow.js";

// require ("swiper-animate-cn");

//整合关于我们用到的所有js
import{getCase}from "./request.js";
import { partner } from "./common.js";

//引入懒加载
import{lazyLoad} from "../utils/lazyLoad.js";


//调用合作伙伴图片--common里
partner();


//获取页面图片
let Imgs = document.querySelectorAll('header img,main div:not(:last-child) img')
console.log(Imgs);

async function xixiha(){
  let res5 = await getCase();
  console.log(res5);
  let arr5 = [];
  res5.results.forEach(function(item){
    arr5.push(item.photo_detal.url);
  })
  Imgs.forEach(function(item,index){
    item.setAttribute('data-src',arr5[index])
  })

  lazyLoad(Imgs);
}
xixiha();

//宽高公式
// function vw(w) {
//     return (w / 1910) * 100 + "vw";
//   }
  
  //导航栏吸顶
  // let nav = document.querySelector(".nav");
  // window.onscroll = function () {
  //   let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  //   scrollTop < 300 ? (nav.style.top = vw(-80)) : (nav.style.top = 0);
  // };


  new WOW().init()

  //首图效果-小盒子动画
  let fangan = document.querySelectorAll(".fangan")
  fangan.forEach(function(item){
    item.addEventListener('mouseover',function(){
      item.classList.toggle("animated")
      item.classList.toggle("flipInY")
      item.classList.toggle("animated.delay-2s")
     
    })
  })
 //首图遮罩点击消失
  let heise = document.querySelector('.heise') 
  heise.onclick=function(){
    console.log(123);
    this.classList.toggle("animated")
    this.classList.toggle("fadeOut")
  }

  //方案展示页面切换--选项卡
  let btns = document.querySelectorAll(".xuanxiang>li")
  let boxs = document.querySelectorAll(".anli")
  console.log(boxs);

  btns.forEach(function(item,index){

    item.onclick=function(){
     
      for(var i=0;i<btns.length;i++){
        btns[i].classList.remove('active');
        boxs[i].classList.remove('active');
      }

      btns[index].classList.add('active');
      boxs[index].classList.add('active');

    }
  })

  //方案展示---遮罩显示
  let anli = document.querySelectorAll('.anli-1')
  let hei5 = document.querySelectorAll('.hei5')
  console.log(anli);
  console.log(hei5);
 
  anli.forEach(function(item,index){
    anli[index].onmouseenter=function(){
          hei5[0].style.opacity= 1;   
    }
    anli[index].onmouseleave =function(){
        hei5[0].style.opacity= 0;
    }

  })


